package com.bionic.banking.commands;

import com.bionic.banking.auth.manager.Config;
import com.bionic.banking.dao.connection.LoggerLoader;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CommandStartCreateBankAccount implements ICommand {

    private static final org.apache.log4j.Logger logger =
            LoggerLoader.getLogger(CommandStartCreateBankAccount.class);

    @Override
    public String execute(HttpServletRequest request, HttpServletResponse response)
            throws ServletException {
        String page = null;
        try {         
            // to show 'create bankaccount page' in main content
            request.setAttribute("content", Config.getInstance().getProperty(Config.CREATE_BANKACCOUNT));
            page = Config.getInstance().getProperty(Config.MAIN);            
        } catch (Exception ex) {
            logger.error(ex);
            request.setAttribute("error", ex.getMessage());
            page = Config.getInstance().getProperty(Config.ERROR);
        }
        return page;
    }
}
